home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / pcxbgi1.exe / lha / TC.DOC < prev    next >
Text File  |  1991-03-03  |  3KB  |  62 lines

  1.  
  2.               How To Use PCX2BGI Images In Turbo C Programs
  3.                       By Marty Balash, Waterbury CT
  4.  
  5.     Draw your images using a paint program such as Deluxe Paint or
  6.   PC-Paintbrush, which save in .LBM or .PCX format. If you use another paint
  7.   program, find a commercial or shareware conversion program that will
  8.   convert to .LBM or .PCX - there are many available.  Use the 640x349
  9.   16-color mode of your paint program.
  10.     Following the instructions in PCX2BGI.DOC, use PCX2BGI.EXE to
  11.   load your picture and select a "Partial Screen" or "Full Screen" type of
  12.   image save.
  13.     With your picture displayed on the screen, frame and save the sections of
  14.    the picture you would like to use in your program. After saving them as
  15.   .MJB files, use the following six steps to load and display them from disk.
  16.  
  17. SIX STEPS to read and display a .MJB image in a Turbo C program:
  18.   1 - Read the 28-byte header to get the following information:
  19.         * struct IMAGEHDR{
  20.         *   char id[8];                 /* id      - Should be "PCX2BGI" */
  21.         *   unsigned size;              /* size    - bytes to malloc     */
  22.         *   struct palettetype palette; /* palette - for image           */
  23.         * };
  24.   2 - Set the palette to "palette" using setallpalette
  25.   3 - Malloc a buffer of "size" bytes of memory
  26.   4 - Read remainder of file ("size" bytes of data) into the buffer
  27.   5 - Put the buffer on the screen with putimage
  28.   6 - Free the buffer when you're done with it
  29.  
  30.  
  31. File Layouts:
  32.   o - PARTIAL SCREEN .MJB File Format:
  33.         id      = "PCX2BGI"
  34.         size    = <depends on image>
  35.         palette = palette for picture
  36.         a single BGI image file, "size" bytes long
  37.   o - FULL SCREEN .MJB File Format:
  38.         id      = "PCX2BGI"
  39.         size    = 22406
  40.         palette = palette for picture
  41.         5 consecutive BGI image files, each 22406 bytes long
  42.       For a full screen image, the filelength() function in Turbo C
  43.       will return a number larger than 22406 bytes + 28 bytes.
  44. Note:
  45.   o - TPCONV.EXE can be used to strip the header from the data
  46.       leaving a plain BGI format image file
  47.  
  48.   If you find these utilities useful, please mail $15.00 to:
  49.     Marty Balash
  50.     2 Pinecrest Dr.
  51.     Prospect CT 06712
  52.  
  53. Files in .ZIP file for Turbo C programmers:
  54. CYCLE    C    - Source for program that displays & cycles picture CYCLE.MJB
  55. READHC   C    - How to use hard-coded image data created by CIMAGE.EXE
  56. SHOWMJB  C    - Source for .MJB display program
  57. CIMAGE   EXE  - Convert a small .MJB file to C source code
  58. CYCLE    LBM  - Use PCX2BGI.EXE to convert into CYCLE.MJB (save full screen)
  59. TC       DOC  - Documentation for Turbo C programmers
  60.  
  61. * END OF FILE *
  62.